package controller.admin;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;
import com.jfinal.kit.Ret;

import controller.admin.base.BaseAdminController;
import enums.StationStatus;
import enums.StationType;
import service.StationService;

public class AdminStationController extends BaseAdminController {
	@Inject StationService stationService ;

	public void delete() {
        Long id = getParaToLong("id");
        Ret ret = stationService.delete(id);
        renderJson(ret);
    }

	public void list() {
	    Kv kv = getParamKv() ;
	    Integer pageNumber = getParaToInt("pageNumber", 1);
	    Integer pageSize = getParaToInt("pageSize", 10);
	    set("page", stationService.getPage( kv , pageNumber, pageSize));
	    set("stationStatusList", StationStatus.toList());
	    set("stationTypeList", StationType.toList());
	    renderJson();
	}

	public void detail() {
		Long id = getParaToLong("id");
		renderJson("data", stationService.detail(id) );	
	}
}
